package castleContent;

public class Houses extends Building{
	private static final int POPULATION_PER_LEVEL = 120;
	private int populationCapacity;
	private int currentPopulation;
	
	
	@Override
	public void levelUp() {
		super.levelUp();
		increasePopulationCapacity();		
	}
	
	protected void addPopulation(int populationToAdd) {
		if((populationToAdd + getCurrentPopulation()) <= getPopulationCapacity() && populationToAdd > 0) {
			setCurrentPopulation(getCurrentPopulation() + populationToAdd);
		}
	}
	
	protected void subtractPopulation(int populationToSubtract) {
		setCurrentPopulation(getCurrentPopulation() - populationToSubtract);
	}
	
	private void increasePopulationCapacity() {
		setPopulationCapacity(getPopulationCapacity() + POPULATION_PER_LEVEL);
	}
	
	public int getPopulationCapacity() {
		return populationCapacity;
	}
	
	private void setPopulationCapacity(int populationCapacity) {
		this.populationCapacity = populationCapacity;
	}
	
	public int getCurrentPopulation() {
		return currentPopulation;
	}
	
	private void setCurrentPopulation(int currentPopulation) {
		this.currentPopulation = currentPopulation;
	}
	
	
}
